package com.sc.nft.task;

import com.sc.nft.dao.UserCollectionDao;
import com.sc.nft.entity.UserCollection;
import com.sc.nft.service.UserCollectionService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;


@Component
@RequiredArgsConstructor
@Slf4j
public class GiveStatusTask {


    private final UserCollectionService userCollectionService;
    private final UserCollectionDao userCollectionDao;

    @XxlJob("editGiveStatus")
    public void editGiveStatus() throws Exception {
        List<UserCollection> list = userCollectionDao.getOneByGiveStatus();
        for (UserCollection userCollection : list) {
            userCollectionService.editGiveStatus(userCollection);
        }

    }
}
